#! /bin/sh

make clean; make

alias corkline=`realpath ./corkline`
alias terms=`realpath ./term-color.py`

_mark="•"

HISTCONTROL=ignorespace

_prompt_cmd() {
    _status=$?
    _curcmd=$(builtin history 1)
    if [ $_status -eq 0 ]; then
        _status="\[\033[1;38;5;39m\]$_mark\[\033[0m\]"
    else
        _status="\[\033[1;38;5;204m\]$_mark\[\033[0m\]"
    fi

    if [ "$_curcmd" == "$_precmd" ]; then
        # nothing input
        _status="\[\033[1;38;5;240m\]$_mark\[\033[0m\]"
    else
        _precmd=$_curcmd
    fi

    PS1="$_status$(corkline)"
}

PROMPT_COMMAND='_prompt_cmd'
